package com.syswin.lhztest.service.listener;

import com.syswin.lhztest.service.event.OrderEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.SmartApplicationListener;
import org.springframework.stereotype.Service;

/**
 * 监听订单创建 发送短信
 * @author:lhz
 * @date:2018/11/14 16:09
 */
@Service
public class WechetListener implements SmartApplicationListener {
    @Override
    public boolean supportsEventType(Class<? extends ApplicationEvent> eventType) {
        return eventType == OrderEvent.class;
    }

    @Override
    public boolean supportsSourceType(Class<?> sourceType) {
        return true;
    }

    //执行顺序，值越大 执行越靠后
    @Override
    public int getOrder() {
        return 59;
    }

    //事件发生时调用
    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {

        System.out.println("2、发微信");
    }
}
